<?php defined('In33hao') or exit('Access Invalid!');?>

<div class="page">
  <div class="fixed-bar">
    <div class="item-title"><a class="back" href="index.php?act=sq_setting&op=index" title="返回图片列表"><i class="fa fa-arrow-circle-o-left"></i></a>
      <div class="subject">
        <h3>轮播图 - <?php echo $lang['nc_new'];?></h3>
        <h5>手机商圈模块广告轮播图设置</h5>
      </div>
    </div>
  </div>
  <form id="link_form" enctype="multipart/form-data" method="post">
    <input type="hidden" name="form_submit" value="ok" />
    <div class="ncap-form-default">
      <dl class="row">
        <dt class="tit">
          <label for="link_catetory"><em>*</em>图片标题</label>
        </dt>
        <dd class="opt">
          <input id="banner_title" name="banner_title" value="<?php echo $output['banner']['title'] ?>" class="input-txt" type="text" />
          <span class="err"></span>
          <p class="notic">展示标题</p>
        </dd>
      </dl>
        <dl class="row">
            <dt class="tit">
                <label for="store_name"><em>*</em>推荐类别</label>
            </dt>
            <dd class="opt">
                <input type="radio" value="0" <?php if($output['banner']['tags']==0) { echo "checked" ;}  ?> name="banner_tag" id="tag"><label for="tag">每日推荐</label>
                <input type="radio" value="1" <?php if($output['banner']['tags']==1) { echo "checked" ;}  ?>  name="banner_tag" id="tag1"><label for="tag1">热门商家</label>
            </dd>
        </dl>
      <dl class="row">
        <dt class="tit">
          <label for="link_pic"><em>*</em><?php echo $lang['link_index_pic_sign'];?></label>
        </dt>
        <dd class="opt">
            <div class="input-file-show"><span class="show"> <a class="nyroModal" rel="gal" href="<?php echo $output['banner']['pic'];?>"> <i class="fa fa-picture-o" onMouseOver="toolTip('<img src=<?php echo $output['banner']['pic'];?>>')" onMouseOut="toolTip()"></i></a> </span> <span class="type-file-box">
            <input name="link_pic" type="file" class="type-file-file" id="link_pic" size="30" hidefocus="true">
            </span></div>
          <span class="err"></span>
          <p class="notic">展示图片，建议大小300x280像素PNG图片。</p>
        </dd>
      </dl>
        <dl class="row">
            <dt class="tit">
                <label for="link_catetory">图片链接</label>
            </dt>
            <dd class="opt">
                <input id="link" name="link" value="<?php echo $output['banner']['links'] ?>" class="input-txt" type="text" />
                <input id="link" name="id" value="<?php echo $output['banner']['id'] ?>" class="input-txt" type="hidden" />
                <span class="err"></span>
                <p class="notic">设置图片跳转链接</p>
            </dd>
        </dl>
      <div class="bot"><a href="JavaScript:void(0);" class="ncap-btn-big ncap-btn-green" id="submitBtn"><?php echo $lang['nc_submit'];?></a></div>
    </div>
  </form>
</div>
<script>
$(function(){
	//图片上传
	var textButton="<input type='text' name='textfield' id='textfield1' class='type-file-text' /><input type='button' name='button' id='button1' value='选择上传...' class='type-file-button' />"
	$(textButton).insertBefore("#link_pic");
	$("#link_pic").change(function(){
	$("#textfield1").val($("#link_pic").val());
	});
	//按钮先执行验证再提交表单
	$("#submitBtn").click(function(){
    if($("#link_form").valid()){
     $("#link_form").submit();
	}
    });
//
	$('#link_form').validate({
        errorPlacement: function(error, element){
        	var error_td = element.parents('dl').find('span.err');
            error_td.append(error);
        },
        success: function(label){
            label.addClass('valid');
        },
        rules : {
            link_category  : {
                required : true
            },
        },
        messages : {
            link_category  : {
                required : '<i class="fa fa-exclamation-circle"></i><?php echo $lang['link_add_category_null'];?>'
            },
        }
    });
});
</script> 
